/*
 * Copyright (c) 2005 -2008 Reliable Source, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Mozilla Public License v.1.1,
 * BSD, and Eclipse Public License v1.0 which accompanies this
 * distribution and is available at:
 *
 * 		http://www.eclipse.org/legal/epl-v10.html
 * 		http://www.opensource.org/licenses/bsd-license.php
 * 		http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * Contributors:
 *     IBM Corporation	     -  http://ibm.com
 *     	- initial API and implementation
 *
 *     Reliable Source, Inc. - http://reliablesource.org
 *
 */
package org.reliablesource.model.core;

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;

/**
 * 
 * ReliableCoreActivator.java<br>
 * Created on: Jun 27, 2008<br>
 *
 * @author <a href="mailto:dennis.park@gmail.com">Dennis Park</a>
 *
 * @category
 * @since 1.0
 */
public class ReliableCoreActivator extends Plugin {

    final public static Object[] EMPTY_OBJECT = new Object[0];

    final public static String EMPTY_STRING = new String(""); //$NON-NLS-1$

    final public static IReliableElement EMPTY_PARENT = new ReliableElement(
            ReliableElement.NO_ID, ReliableElement.NO_NAME);

    public static final Object[] NULL_OBJECT = new Object[0];


    private static IReliableElementFactory elementFactory;

    // NOTE: Keep this model's scope of visibility to this package ONLY!
    private static IReliableModel model;
    
    public final static String LINE_SEPERATOR = System.getProperty("line.separator");
    
    
    static {
        elementFactory = ReliableElementFactory.getInstance();
        model = elementFactory.getApplicationModel();
    }
    

    public IReliableModel getModel(){
        return model;
    }
    
    public IReliableElementFactory getElementFactory(){
        return elementFactory;
    }
    
    
    // The plug-in ID
    public static final String PLUGIN_ID = "org.reliablesource.model.core"; //$NON-NLS-1$

    // The shared instance
    private static ReliableCoreActivator plugin;

    /**
     * The constructor
     */
    public ReliableCoreActivator() {
        plugin = this;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
     */
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    /**
     * Returns the shared instance
     * 
     * @return the shared instance
     */
    public static ReliableCoreActivator getDefault() {
        return plugin;
    }
}
